<?php
namespace app\houtai\controller\user;
use app\houtai\controller\BaseController;
use think\Db;
use think\Request;
use think\db\Expression;
use org\GoApi\UserDetail;

class PrivateController extends BaseController{
    /**
     * @brief  : 用户详情
     *  @return : page
     *  @details:
     * */
    public function indexAction(){
        $conds = [];
        $order = [];
        $familyID = $this->request->param('FamilyID/d',0);
        if ($familyID > 0) {
            $conds['a.FamilyID'] = ['eq',$familyID];
        }
        $orderMap = [
            'B' => 'UserID',
            'C' => 'GameID',
            'D'  => 'Score',
            'E'  => 'WinCount',
            'F'  => 'LostCount',
            'G'  => 'DrawCount',
            'H'  => 'FleeCount',
        ];
        $this->orderField = array_key_exists($this->orderField, $orderMap) ? $this->orderField : 'B';
        $order[$orderMap[$this->orderField]] = $this->orderDirection;
        $list = table('FamilyGoldInfo a', 'rydb.websms')->field([
            'a.FamilyID','a.UserID ','a.Score','a.InsureScore','a.WinCount','a.LostCount','a.DrawCount',
            'c.GameID', 'c.Accounts', 'c.NickName','a.FleeCount',
            'c.AccountsType', 'c.LastLogonIP', 'c.RegisterIP', 'c.GameLogonCount', 'c.LastLogonDate',
            'c.RegisterDate', 'c.RegisterMobile'=>'MobilePhone', 'c.Compellation', 'c.PassPortID',
            'c.AccountImgUrl'=>'HeadImgUrl',
            'c.Sex', 'c.Channel'
        ])
            ->join('CYBasicDB.dbo.AccountsInfo c','c.UserID = a.UserID','LEFT')
            ->where($conds)->order($order)->paginate();
        return $this->fetch('',[
            'list'  => $list,
            'FamilyID' =>$familyID,
        ]);
    }



}
